package cn.com.blueInfo.HaiYuan.business.purchase.controller;

import cn.com.blueInfo.HaiYuan.business.purchase.service.PurchaseDetailService;
import cn.com.blueInfo.utils.result.BootstrapTable;
import cn.com.blueInfo.utils.result.ResultInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * 采购单明细行接口
 * @ClassName: PurchaseDetailController
 * @author suxch
 * @date 2020年11月7日  下午2:33:21
 */
@RestController
@RequestMapping("/operation/business/purchaseDetail")
public class PurchaseDetailController {

    @Autowired
    private PurchaseDetailService purchaseDetailService;

    /**
     * 分页查询采购单明细行信息
     * @Title: queryPurchaseDetailInfoByPage
     * @param request
     * @return BootstrapTable
     * @throws
     */
    @RequestMapping("/queryPurchaseDetailInfoByPage.do")
    public BootstrapTable queryPurchaseDetailInfoByPage(HttpServletRequest request) {
        return purchaseDetailService.queryPurchaseDetailDataByPage(request);
    }

    /**
     * 新增采购单明细行信息
     * @Title: addPurchaseDetailInfo
     * @param request
     * @return ResultInfo
     * @throws
     */
    @RequestMapping("/addPurchaseDetailInfo.do")
    public ResultInfo addPurchaseDetailInfo(HttpServletRequest request) {
        return purchaseDetailService.insertPurchaseDetailData(request);
    }

    /**
     * 更新采购单明细行信息
     * @Title: updatePurchaseDetailInfo
     * @param request
     * @return ResultInfo
     * @throws
     */
    @RequestMapping("/updatePurchaseDetailInfo.do")
    public ResultInfo updatePurchaseDetailInfo(HttpServletRequest request) {
        return purchaseDetailService.updatePurchaseDetailData(request);
    }

    /**
     * 删除采购单明细行信息
     * @Title: deletePurchaseDetailInfo
     * @param request
     * @return ResultInfo
     * @throws
     */
    @RequestMapping("/deletePurchaseDetailInfo.do")
    public ResultInfo deletePurchaseDetailInfo(HttpServletRequest request) {
        return purchaseDetailService.deletePurchaseDetailData(request);
    }

    /**
     * 导入Excel模板
     * @Title: importExcelModel
     * @param request
     * @param response
     * @return void
     * @throws
     */
    @RequestMapping("/importExcelModel.do")
    public void importExcelModel(HttpServletRequest request, HttpServletResponse response) {
        purchaseDetailService.importExcelModel(request, response);
    }

    /**
     * 导入明细行信息
     * @Title: importDetailInfo
     * @param request
     * @param file
     * @return ResultInfo
     * @throws
     */
    @RequestMapping("/importDetailInfo.do")
    public ResultInfo importDetailInfo(HttpServletRequest request, MultipartFile file) {
        return purchaseDetailService.importDetailData(request, file);
    }

    /**
     * 获取采购明细信息
     * @Title: queryPurchaseDetailInfo
     * @param request
     * @return ResultInfo
     * @throws
     */
    @RequestMapping("/queryPurchaseDetailInfo.do")
    public ResultInfo queryPurchaseDetailInfo(HttpServletRequest request) {
        return purchaseDetailService.queryPurchaseDetailData(request);
    }

}
